﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _004_数组作业_偶奇排序_
{
    class Program
    {
        public static int[] ParitySort(int[] IntArr) {
            string sum = "";
            for (int i = 0; i < IntArr.Length; i++)
            {
                if (IntArr[i] % 2 == 0)
                {
                    sum += IntArr[i] + " ";
                }
            }
            for (int i = 0; i < IntArr.Length; i++)
            {
                if (IntArr[i] % 2 == 1)
                {
                    sum += IntArr[i] + " ";
                }
            }
            sum = sum.Substring(0, sum.Length - 1);
            string[] strArr = sum.Split(' ');
            for (int i = 0; i < IntArr.Length; i++)
            {
                IntArr[i] = Convert.ToInt32(strArr[i]);
            }
            return IntArr;
        }
        static void Main(string[] args)
        {
            int[] arr = { 10, 51, 6, 79, 25, 8, 7, 46, 1 };
            ParitySort(arr);
            foreach (var temp in arr)
            { 
                Console.Write(temp + " ");
            }
            Console.ReadKey();
        }
    }
}
